﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ExportPhoto
{
    class Program
    {

        static void Main(string[] args)
        {
            ISISDataContext DS = new ISISDataContext();

            var query = from Photo in DS.SCH_SingleStudentPhotos
                        select Photo ;
            foreach (SCH_SingleStudentPhoto itemPhoto in query)
            {
                var fs = new BinaryWriter(new FileStream(@"C:\\tmp\\" + itemPhoto.MemberID.ToString() + ".jpg", FileMode.Append, FileAccess.Write));
                if (itemPhoto.Picture != null)
                {
                    fs.Write(itemPhoto.Picture.ToArray());
                    fs.Close();
                }
                Console.WriteLine(itemPhoto.MemberID);
            }
        }
    }
}
